//-----------------------------------------------------------------------
// <copyright file="EndpointCollection.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Microsoft.Live.Messenger
{
    using System;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.Diagnostics;
    using Microsoft.Live.Core;

    /// <summary>
    /// Represents a collection of endpoints.
    /// </summary>
    public sealed class EndpointCollection : Collection
    {
        internal EndpointCollection(object obj, User user)
            : base(obj, user)
        {
        }

        /// <summary>
        /// Gets the <c>Endpoint</c> at the specific index.
        /// </summary>
        /// <param name="index">The zero-based index of the <c>Endpoint</c> to get.</param>
        /// <returns>The <c>Endpoint</c> at the specified index.</returns>
        public Endpoint this[int index]
        {
            get { return (Endpoint)this.GetItem(index); }
        }

        internal override object FindOrCreate(MessengerEntity entity)
        {
            return this.User.EndpointFactory.FindOrCreate(entity);
        }
    }
}